﻿using Blog.Core.Domain.Model;
using Blog.Core.DTO.ViewModel;
using Blog.Core.IServices;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Blog.Core.Api.Controllers
{
    /// <summary>
    /// 日志记录到数据库控制器
    /// </summary>
    [Authorize]
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LogRecordController : ControllerBase
    {
        private readonly IlogRecordIService ilogRecordIService;
        public LogRecordController(IlogRecordIService ilogRecordIService)
        {
            this.ilogRecordIService = ilogRecordIService;
        }
        /// <summary>
        /// 系统日志的显示（查询）操作
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetLogList([FromQuery]PagelogRecordDTO? dto)
        {
            var list = (await ilogRecordIService.GetLogList(dto));
            return Ok(list);
        }
    }
}
